package main

import (
	"common/config"
	"common/logs"
	"context"
	"flag"
	"gate/app"
	"go.uber.org/zap"
	"os"
)

var configFile = flag.String("game", "application.yml", "game file")

func main() {

	//1 加载配置
	flag.Parse()
	config.InitConfig(*configFile)

	//2 加载zap日志
	logs.InitLogger()

	//3 启动golang监控
	go func() {
		//err := metrics.Serve(fmt.Sprintf("0.0.0.0:%d", game.Conf.MetricPort))
		//if err != nil {
		//	panic(err)
		//}
		zap.S().Info("app gate metrics run success")
	}()
	err := app.Run(context.Background())
	if err != nil {
		panic(err)
		os.Exit(-1)
	}
	zap.S().Info("app gate up success")
}
